cmake_minimum_required(VERSION 3.27)
project(ACE_TAO_PROJ VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 11)
if(WIN32)
add_compile_options("/utf-8")
add_compile_options(/W4)
add_compile_options(/wd4828)
endif()

#设置ACE环境

 #include(cmake/util_vita.cmake)
 include(cmake/ace_tao.cmake)
 include(cmake/generate_tao_stub.cmake)
 #设置编译类型
if(NOT CMAKE_BUILD_TYPE)
set(DEBUG_LEVEL 1 CACHE STRING "debug level")
set(CMAKE_BUILD_TYPE Debug) # Debug Release
message(STATUS "生成 Debug 版本")  
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message(STATUS "生成 Debug 版本")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(STATUS "生成 Release 版本")
endif()
##################################################################################
#设置输出路径
set(OUTPUT_PREFIX output)

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${OUTPUT_PREFIX}/Debug)#安装路径

set(OUTPUT_INCLUDE_DIR_DEBUG "../output/Debug/include")

elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${OUTPUT_PREFIX}/Release)#安装路径
set(OUTPUT_INCLUDE_DIR_RELEASE "../output/Release/include")
else()
message(FATAL_ERROR "请检查编译类型 CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE} [Debug/Release] 是否正确!")
endif()
##################################################################################

link_libraries(
    debug ACEd.lib optimized ACE.lib
    debug TAOd.lib optimized TAO.lib
    debug TAO_AnyTypeCoded.lib optimized TAO_AnyTypeCode.lib
    debug TAO_Valuetyped.lib optimized TAO_Valuetype.lib
    debug TAO_PortableServerd.lib optimized TAO_PortableServer.lib
    debug TAO_CodecFactoryd.lib optimized TAO_CodecFactory.lib
    debug TAO_PId.lib optimized TAO_PI.lib
    debug TAO_Messagingd.lib optimized TAO_Messaging.lib
    debug TAO_Svc_Utilsd.lib optimized TAO_Svc_Utils.lib
    debug TAO_RTEventd.lib optimized TAO_RTEvent.lib
    debug TAO_RTEvent_Skeld.lib optimized TAO_RTEvent_Skel.lib
    debug TAO_RTEvent_Servd.lib optimized TAO_RTEvent_Serv.lib
    debug TAO_CosNamingd.lib optimized TAO_CosNaming.lib
    debug TAO_RTSchedd.lib optimized TAO_RTSched.lib
    debug TAO_RTSchedEventd.lib optimized TAO_RTSchedEvent.lib
    debug TAO_BiDirGIOPd.lib optimized TAO_BiDirGIOP.lib
    debug TAO_Strategiesd.lib optimized TAO_Strategies.lib
    
    #容错
    debug TAO_ReplicationManagerLibd.lib optimized TAO_ReplicationManagerLib.lib
    debug TAO_PortableGroupd.lib optimized TAO_PortableGroup.lib
    debug TAO_CosEventd.lib optimized TAO_CosEvent.lib
    debug TAO_CosNotificationd.lib optimized TAO_CosNotification.lib
    debug TAO_IORManipd.lib optimized TAO_IORManip.lib
    debug TAO_FTORB_Utilsd.lib optimized TAO_FTORB_Utils.lib
    debug TAO_FT_ClientORBd.lib optimized TAO_FT_ClientORB.lib
    debug TAO_PI_Serverd.lib optimized TAO_PI_Server.lib
    debug TAO_FaultToleranced.lib optimized TAO_FaultTolerance.lib
    debug TAO_FT_ServerORBd.lib optimized TAO_FT_ServerORB.lib
    debug TAO_CosEvent_Skeld.lib optimized TAO_CosEvent_Skel.lib
    debug TAO_CosNotification_Skeld.lib optimized TAO_CosNotification_Skel.lib
    debug TAO_IORTabled.lib optimized TAO_IORTable.lib
    
    #
    iphlpapi.lib
)


add_subdirectory(messenger_demo)
add_subdirectory(get_nlist_test)
add_subdirectory(ns_test)
add_subdirectory(object_group_test)